package com.example.myactivitybase.service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;

import androidx.annotation.Nullable;

/**
 * 服务接口
 */
public class MyService extends Service {

    private static final String TAG = "MyService";

    @Override
    public void onCreate() {
        Log.d(TAG, TAG + "------> onCreate()");
        super.onCreate();
    }

    /**
     * 已过时，使用 onStartCommand
     * @param intent intent
     * @param startId startId
     */
    @Override
    public void onStart(Intent intent, int startId) {
        Log.d(TAG, TAG + "------------> onStart()");
        super.onStart(intent, startId);
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        Log.d(TAG, TAG + "----------> onStartCommand()");
        return super.onStartCommand(intent, flags, startId);
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        Log.d(TAG, TAG + "------> onBind()");
        return null;
    }

    @Override
    public boolean onUnbind(Intent intent) {
        Log.d(TAG, TAG + "---------> onUnbind()");
        return super.onUnbind(intent);
    }

    @Override
    public void onDestroy() {
        Log.d(TAG, TAG + "---------> onDestroy()");
        super.onDestroy();
    }
}
